<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>

	<head></head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>会员注册</title>
	<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" type="text/css" />
	<script src="<%=request.getContextPath()%>/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
	<script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/jquery-heima-0.0.1.js" ></script>
	<!-- 引入自定义css文件 style.css -->
	<script type="text/javascript">
		var isclick = false;
		function hasusername() {
	        var username = $.trim($("#username").val());
	        if ($.trim(username) ==""){
	        	$("#userNameSpan").html("");
	            return;
	        }
			HM.ajax("<%=request.getContextPath()%>/userServlet","method=hasUser&username="+username,function(data){
				//data响应回来的json
				if(data.code==1){
					$("#userNameSpan").html(data.message).css("color","green");
					isclick = true;
				}else {
	                $("#userNameSpan").html(data.message).css("color","red");
	                isclick = false;
	            }
			});
	   }
	   function sub() {
		   var formsubmit = document.getElementById("formid");
		   if(isclick){
			   formsubmit.submit();
		   }
	   }
		function fnChange() {
			var code = document.getElementById("code");
			var date = new Date().getTime();
			code.src="<%=request.getContextPath()%>/userServlet?method=checkCode&a="+date;
		}
	</script>
	</head>
	<body>
		<div class="container-fluid"  style="max-width: 1370px;">
			<!--头部-->
			<div id="header" style="min-height: 130px;"><jsp:include page="header.jsp" /></div>
			<div class="container-fluid" style="width:98%;background:url('resources/img/regist_bg.jpg');">
				<div class="row">
					<div class="col-md-2"></div>
					<div class="col-md-8" style="background:#fff;padding:40px 80px;margin:30px;border:7px solid #ccc;">
						<font style="color: #3164af;font-size: 18px;font-weight: normal;padding: 0 10px;">会员注册</font>USER REGISTER
						<form id="formid" class="form-horizontal" style="margin-top:5px;" action="<%=request.getContextPath()%>/userServlet" method="post">
							<!-- type=hidden 隐藏域 ,页面不显示-->
							<input type="hidden" name="method" value="userRegister">
							<div class="form-group">
								<label for="username" class="col-sm-2 control-label">用户名</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="username" placeholder="请输入用户名" name="username" onblur="hasusername()">
									<span id="userNameSpan"></span>
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
								<div class="col-sm-6">
									<input type="password" class="form-control" id="inputPassword3" placeholder="请输入密码" name="password">
								</div>
							</div>
							<div class="form-group">
								<label for="confirmpwd" class="col-sm-2 control-label">确认密码</label>
								<div class="col-sm-6">
									<input type="password" class="form-control" id="confirmpwd" placeholder="请输入确认密码">
								</div>
							</div>
							<div class="form-group">
								<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
								<div class="col-sm-6">
									<input type="email" class="form-control" id="inputEmail3" placeholder="Email" name="email">
								</div>
							</div>
							<div class="form-group">
								<label for="usercaption" class="col-sm-2 control-label">姓名</label>
								<div class="col-sm-6">
									<input type="text" class="form-control" id="usercaption" placeholder="请输入姓名" name="name">
								</div>
							</div>
							<div class="form-group opt">
								<label for="inlineRadio1" class="col-sm-2 control-label">性别</label>
								<div class="col-sm-6">
									<label class="radio-inline">
									  <input type="radio" name="gender" id="inlineRadio1" value="男"> 男
									</label>
									<label class="radio-inline">
									  <input type="radio" name="gender" id="inlineRadio2" value="女"> 女
									</label>
								</div>
							</div>
							<div class="form-group">
								<label for="inputEmail0" class="col-sm-2 control-label">出生日期</label>
								<div class="col-sm-6">
									<input type="date" id="inputEmail0"  class="form-control" name="birthday">
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label">验证码</label>
								<div class="col-sm-3"style="margin-right: 0;padding-right: 0;">
									<input type="text" class="form-control" name="code" id="inputPassword4" placeholder="请输入验证码">
								</div>
								<div class="col-sm-3" style="margin-left: 5px;padding-left: 0;">
									<img src="<%=request.getContextPath()%>/userServlet?method=checkCode" onclick="fnChange()" id="code" />
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<input id="regBut" type="button" width="100" value="注册" onclick="sub()" border="0" style="background-color:#CD062D;height:35px;width:100px;color:white;">
									<span id="errorSpan" style="color: red">${Error}</span>
								</div>
							</div>
						</form>
					</div>
	
					<div class="col-md-2"></div>
	
				</div>
			</div>
			<!--尾部-->
			<div id="footer"  style="min-height: 203px;"><jsp:include page="foot.jsp" /></div>
		</div>

	</body>